package edu.yonsei.iwb.smarttv.model;

import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import java.util.Vector;

/**
 * 
 * 
 * @author DK
 */
public class ConceptArc {
    private ResourceNode head;
    private ResourceNode tail;
    private int arcType = ArcType.RESOURCE_TYPE;
    private Vector<Property> property;
//    private WeightFactory weightFactory;

//    public ConceptArc(MNode tail, MNode head, Resource property, WeightFactory weightFactory) {
//        this.tail = tail;
//        this.head = head;
//        this.property = property;
//        this.weightFactory = weightFactory;
//    }
    public ConceptArc() {       
        
    }    
    
    public ConceptArc(ResourceNode head, ResourceNode tail) {
        this.head = head;
        this.tail = tail;
        this.property = new Vector<Property>();
//        this.weightFactory = weightFactory;
    }
    
    public ConceptArc(ResourceNode head, ResourceNode tail, int type) {
        this.head = head;
        this.tail = tail;
        this.arcType = type;
        this.property = new Vector<Property>();
//        this.weightFactory = weightFactory;
    }
    
    public ConceptArc(ResourceNode head, ResourceNode tail, Property p) {
        this.head = head;
        this.tail = tail;        
        this.property = new Vector<Property>();
        this.property.add(p);
//        this.weightFactory = weightFactory;
    }

//    public WeightFactory getWeightFactory() {
//        return weightFactory;
//    }
//
//    public void setWeightFactory(WeightFactory weightFactory) {
//        this.weightFactory = weightFactory;
//    }

    public void setTail(ResourceNode tail) {
        this.tail = tail;
    }

    public void setHead(ResourceNode head) {
        this.head = head;
    }
    
    public void addProperty(Property property) {
        this.property.add(property);
    }
    public ResourceNode getHead() {
        return this.head;
    }

    public ResourceNode getTail() {
        return this.tail;
    }    

    public Vector<Property> getProperty() {
        return this.property;
    }

//    public double getWeight() {
//        return weightFactory.evaluate();
//    }
    
    public int getArcType() {
        return this.arcType;
    }
    
    public boolean contains(Resource r){        
        if(this.head.getNode().equals(r)){
            return true;
        }else if(this.tail.getNode().equals(r)){
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        String s = this.head.getNode().getURI() + " --> " + this.property + " --> " + this.tail.getNode().getURI();
        
                
        return s;
    }
            
}
